/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#include "BlenderSkeletonLoader.h"

#include "BlenderSkeletonLoadImpl.h"
#include "OgreAnimation.h"

namespace GNgine
{
	BlenderSkeletonLoader::BlenderSkeletonLoader(bParse::bBlenderFile *fp, Blender::Object *ob) :
		_file(fp), _object(ob)
	{
		assert(_file);
		assert(_object);
	}

	BlenderSkeletonLoader::~BlenderSkeletonLoader()
	{
	}

	void BlenderSkeletonLoader::loadResource(Ogre::Resource *resource)
	{
		assert(_file);
		assert(_object);
		assert(resource);

		Ogre::Animation::setDefaultInterpolationMode(Ogre::Animation::IM_LINEAR);
		Ogre::Animation::setDefaultRotationInterpolationMode(Ogre::Animation::RIM_LINEAR);

		BlenderSkeletonLoadImpl impl(_file,  _object, static_cast<Ogre::Skeleton*>(resource));
		impl.load();
	}
}
